import tensorflow as tf


@tf.function
def printbar():
    """
    打印时间分割线
    :return:
    """
    today_ts = tf.timestamp() % (24 * 60 * 60)
    hour = tf.cast(today_ts // 3600 + 8, tf.int32) % tf.constant(24)
    minite = tf.cast((today_ts % 3600) // 60, tf.int32)
    second = tf.cast(tf.floor(today_ts % 60), tf.int32)

    def timeformat(m):
        return tf.strings.format('0{}', m) if tf.strings.length(tf.strings.format('{}', m)) == 1 \
            else tf.strings.format('{}', m)

    timestring = tf.strings.join([timeformat(hour), timeformat(minite), timeformat(second)], separator=':')
    info = '\n' + '=' * 45 + ' ' + timestring + ' ' + '=' * 45
    # info = '\n' + '=' * 45 + ' {} '.format(datetime.datetime.now().strftime('%H:%M:%S')) + '=' * 45
    tf.print(info)
